<docs>
  ## 个人评价页
</docs>
<template>
  <div class="bg_g">
    <!-- <co-form :model="data" :rules="rules"> -->
    <div class="box" style="background:white">
      <div class="self">自我评价信息</div>

      <!-- <div class="slot">默认显示提示或建议性文字占位，默认显示提示或建议性文字占位，默认显示提示或建议性文字占位，默认显示提示或建议性文字占位，默认显示提示或建议性文字占位</div> -->
      <co-form :model="data" :rules="rules" ref="form">
        <!-- <co-input prop="zwpj" v-model="data.zwpj" placeholder="请输入"></co-input> -->
        <co-area prop="zwpj" v-model="data.zwpj" maxlength="200" placeholder="请输入"></co-area>
      </co-form>
      <div class="title slot" style=" text-indent: 0;">不超过二百字</div>
    </div>
    <!-- </co-form> -->
    <!-- !-- 底部保存 -->
    <div class="info-bottom">
      <button data-v-347f2e5d type="button" class="bc" @click="zwpjBc">保&nbsp;&nbsp;存</button>
    </div>
  </div>
</template>
<script>
import $ from "@/common/js/axios";
import coForm from "@/base/form/form";
import coInput from "@/base/form/input";
import coArea from "@/base/form/textarea";
import { validator } from "@/common/js/valid";
import { mixinValid } from "@/common/mixins/mixins";
import PickerExtend from "picker-extend"; //行政区划插件

export default {
  components: { coInput, coForm, coArea },
  data() {
    return {
      data: {
        jlid: "", //类型：String  可有字段  备注：14,full,简历ID,true
        zwpj: "" //类型：String  必有字段  备注：200,full,自我评价,false
      },
      rules: {
        zwpj: validator('400,"less","自我评价",false')
      }
    };
  },
  computed: {},
  methods: {
    // 自我评价保存  // 只提取输入的汉字
    GetChinese(strValue) {
      // eslint-disable-line
      if (strValue !== null && strValue !== "") {
        const reg = /[\u4e00-\u9fa5]/g;
        return strValue.match(reg).join("");
      }
      return "";
    },
    zwpjBc() {
      // 只提取汉字
      if (this.GetChinese(this.data.zwpj).length > 200) {
        this.$alert({
          type: "warning",
          message: "请输入不超过200汉字的评价"
        });
      } else {
        this.$refs.form.validate(() => {
          $.post("/wdjl/zwpjBc", this.data).then(res => {
            if (res.returnData.executeResult == "1") {
              this.$alert(
                {
                  type: "success",
                  message: res.returnData.message
                },
                () => {
                  this.$router.push({ path: "/cvitae" });
                }
              );
            } else {
              this.$alert({
                type: "warning",
                message: res.returnData.message
              });
            }
          });
        });
      }
    },

    // 自我评价查询
    getzwpj() {
      this.$loading = true;
      $.get("/wdjl/zwpjCx").then(res => {
        this.data.zwpj = res.returnData.zwpj;
        this.$loading = false;
      });
    }
  },
  created() {},
  mounted() {
    this.getzwpj();
  }
};
</script>
<style lang="scss" scoped>
body {
  background: white;
}
.weui-cell {
  width: 90%;
  padding-top: 1rem;
  margin: auto;
  border-bottom: 1px solid rgba(36, 99, 235, 1);
}
.box {
  width: 94%;
  height: 85%;
  overflow: hidden;
  margin: 1rem auto;
}
.slot {
  text-indent: 3em;
  margin: 0.6rem;
  line-height: 0.6rem;
  font-size: 30px;
  color: #999999;
  overflow: hidden;
}
.self {
  font-size: 36px;
  font-weight: bold;
  margin-top: 1rem;
  margin-left: 0.6rem;
}
</style>
